package cn.his2.prescription.controller;

import cn.his2.api.masterdata.MasterDataRemoteClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RefreshScope
@Slf4j
public class DemoController {
    @Resource
    private MasterDataRemoteClient masterDataRemoteClient;
    @Value("${server.port}")
    private int port;
    @Value("${profile}")
    private String profile;

    @GetMapping("")
    public String hello() {
        log.debug("测试elk");
        log.info("info信息很棒");
        log.warn("warn来一个");
        return "Hello 就诊: " + port + "," + profile;
    }

    @GetMapping("/masterdata/hello")
    public String masterDataHello() {
        return masterDataRemoteClient.hello();
    }
    @GetMapping("/masterdata/users")
    public Object masterDataUsers() {
        return masterDataRemoteClient.users();
    }
}
